package com.zkjl.protect_business.utils;


import com.zkjl.protect_business.vo.PageVO;
import com.zkjl.protect_business.common.ApiResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.PageImpl;


/**
 * 响应结果工具类
 */
@Slf4j
public class ResultUtil {


    public static ApiResponse successPagesVO(PageImpl data) {

        PageVO pageVo = new PageVO<>();
        pageVo.setDataList(data.getContent());
        pageVo.setPageNumber(data.getNumber() + 1);
        pageVo.setTotalPage(data.getTotalPages());
        pageVo.setTotalNumber(data.getTotalElements());

        return ApiResponse.ofSuccess(pageVo);
    }





}
